import http.client

conn = http.client.HTTPConnection("192.168.0.235")
conn.request("GET","/TinyShop_v2.4/index.php?con=admin&act=login")
setcookie=conn.getresponse().getheader("Set-Cookie")
sessionid = setcookie.split(";")[0]
print(sessionid)
# param="name=admin&password=admin123&verifycode=aaaa"
# header={"Content-type": "application/x-www-form-urlencoded","Cookie": sessionid}
# conn =http.client.HTTPConnection("192.168.0.235")
# conn.request("POST","/TinyShop_v2.4/index.php?con=admin&act=check",param,header)
# rep = conn.getresponse()
# cont=rep.read().decode()
# print(rep.headers)


conn=http.client.HTTPConnection("192.168.0.235")
headers = {
    "Accept": "image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, imagepeg, application/x-ms-xbap, applicationnd.ms-excel, applicationnd.ms-powerpoint, application/msword, */*",
    "Referer": "http://127.0.0.1/TinyShop_v2.4/index.php?con=goods&act=goods_list",
    "Accept-Language": "zh-CN",
    "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; Tablet PC 2.0)",
    "Accept-Encoding": "gzip, deflate",
    "Connection": "Keep-Alive",
    "Cookie": sessionid

}
# 0是上架，1是下架
conn.request("GET","/TinyShop_v2.4/index.php?con=goods&act=set_online&status=1&id=85", '', headers)
print(conn.getresponse().status)

conn=http.client.HTTPConnection("192.168.0.235")
conn.request("GET","/TinyShop_v2.4/index.php?con=goods&amp;act=goods_list", '', headers)
print(conn.getresponse().status)